package com.example.task.service;

import com.example.common.rabbit.service.RabbitService;
import com.example.common.util.constant.CommonUtilConstants;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

/**
 * @Author juzipi
 * @Date 2021/7/29 20:47
 * @Info
 */
@Component
@EnableScheduling
public class ScheduleJobService {

    @Autowired
    private RabbitService rabbitService;


    @Scheduled(cron = "0 */10 * * * ?")//表示每隔10分钟发送
    public void taskPatient(){
        rabbitService.sendMessage(CommonUtilConstants.TASK_EXCHANGE,CommonUtilConstants.TASK_ROUTING,true);
    }

}
